﻿using System;

namespace CacheSharp.Core
{
    /// <summary>
    /// 缓存器接口
    /// </summary>
    internal interface ICacher : IReader, IWriter, IDisposable
    {
        /// <summary>
        /// 缓存器名称
        /// </summary>
        string CacherName { get; }

        /// <summary>
        /// 缓存器缓存的数据总数
        /// </summary>
        /// <returns>缓存的数据数量</returns>
        int CachedNum();

        /// <summary>
        /// 缓存器在单群组缓存的数据数量
        /// </summary>
        /// <param name="groupName">群组名</param>
        /// <returns>缓存的数据数量</returns>
        int CachedNum(string groupName);

        /// <summary>
        /// 尝试压缩存储
        /// </summary>
        void TryTrimAll();

        /// <summary>
        /// 强制压缩存储
        /// </summary>
        void DelExpire();
    }
}